package edu.zcmu.seckill.vo;

import edu.zcmu.seckill.entity.SeckillProduct;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.math.BigDecimal;

@Data
public class SeckillOrderVo {
    private String orderId;
    private BigDecimal price;
    private String pDescribe;
    private String name;
    private String img;
    private String createTime;
    private Long expire;

    public static SeckillOrderVo createSeckillOrderVo(SeckillProduct product,String createTime,Long expire,String orderId ){
        SeckillOrderVo seckillOrderVo = new SeckillOrderVo();
        BeanUtils.copyProperties(product,seckillOrderVo);
        seckillOrderVo.setOrderId(orderId);
        seckillOrderVo.setCreateTime(createTime);
        seckillOrderVo.setExpire(expire);
        return seckillOrderVo;
    }
}
